package cn.iocoder.yudao.module.pricehistory.dal.mysql.pricehistory1;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.pricehistory.dal.dataobject.pricehistory1.PriceHistoryDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.pricehistory.controller.admin.pricehistory1.vo.*;

/**
 * 记录旅游线路价格的变动历史 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface PriceHistoryMapper extends BaseMapperX<PriceHistoryDO> {

    default PageResult<PriceHistoryDO> selectPage(PriceHistoryPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PriceHistoryDO>()
                .eqIfPresent(PriceHistoryDO::getHistoryId, reqVO.getHistoryId())
                .eqIfPresent(PriceHistoryDO::getRouteId, reqVO.getRouteId())
                .eqIfPresent(PriceHistoryDO::getOldPrice, reqVO.getOldPrice())
                .eqIfPresent(PriceHistoryDO::getNewPrice, reqVO.getNewPrice())
                .betweenIfPresent(PriceHistoryDO::getChangeTime, reqVO.getChangeTime())
                .betweenIfPresent(PriceHistoryDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PriceHistoryDO::getHistoryId));
    }

}